package org.example.campus_sys_backend.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.example.campus_sys_backend.model.StudentInfo;

@Mapper
public interface StudentInfoMapper {
    @Insert("insert into student(stu_name, from_place, parent_phone, current_grade, is_first, user_id, comment, total_score," +
            "online_time_in_minute, total_learned_unit, group_id, class_id) values (#{stuName}, #{fromPlace}, #{parentPhone}, #{currentGrade}, #{isFirst}," +
            "#{userId}, #{comment}, #{totalScore}, #{onlineTimeInMinute}, #{totalLearnedUnit}, #{groupId}, #{classId})")
    Integer insertStudent(StudentInfo studentInfo);
    @Update("update student set status = 1")
    Integer updateStudent(Integer id);
    @Update("update student set class_id = #{classId}")
    Integer allotStudent(@Param("id") Integer id, @Param("classId") Integer classId);

}
